//
//  MenuScene.m
//  FairyGame
//
//  Created by 李 世宸 on 2009/7/30.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//
//  遊戲選單

#import "MenuScene.h"
#import "AliceScene.h"


@implementation MenuScene
- (id) init 
{
    self = [super init];
	
    if (self != nil) 
	{
		//背景圖
        Sprite * bg = [Sprite spriteWithFile:@"menu.png"];
        [bg setPosition:ccp(240, 160)];
		
		//連結背景
        [self addChild:bg z:0];
		
		//連結Layer
        [self addChild:[MenuLayer node] z:1];
    }
    return self;
}

@end

@implementation MenuLayer
- (id) init 
{
    self = [super init];
	
    if (self != nil) 
	{
		//設定字型
        [MenuItemFont setFontSize:20];
        [MenuItemFont setFontName:@"Helvetica"];
		
		//Menu元件
        MenuItem *alicedream = [MenuItemFont itemFromString:@"Alice Dream" target:self selector:@selector(AliceDream:)];
        MenuItem *option = [MenuItemFont itemFromString:@"Option" target:self selector:@selector(Option:)];
		
		//Menu
		Menu *menu = [Menu menuWithItems:alicedream, option, nil];
		
		[menu alignItemsVertically];
		
		//連結Menu
        [self addChild:menu];
    }
    return self;
}

-(void)AliceDream: (id)sender 
{
    AliceScene * gs = [AliceScene node];
    [[Director sharedDirector] replaceScene:gs];
}

-(void)Option: (id)sender 
{
    NSLog(@"help");
}

@end
